﻿using ReactiveUI;
using ReactiveUI.Fody.Helpers;
using ScienceAppService.Entities;
using ScienceAppService.ModuleInterface;
using System.Reactive.Concurrency;

namespace ScienceAIApp.ViewModels.ToolBarPanel;
public class CrossLineViewModel : ScienceBaseViewModel
{
    private IImageShowService _imageShowService;

    [Reactive] public string PositionTxt{get;set;}
    [Reactive] public string CtValTxt{get;set;}

    public CrossLineViewModel(IImageShowService imageShowService) 
    {
        _imageShowService = imageShowService;
        _imageShowService.FrushCrosslineInfoEvent += FrushCrosslineInfoHandle;
    }

    private void FrushCrosslineInfoHandle(CrossLineInfo crossLineInfo)
    {
        RxApp.MainThreadScheduler.Schedule(() => 
        {
            PositionTxt = $"X:{crossLineInfo.X}, Y:{crossLineInfo.Y}, Z:{crossLineInfo.Z}";
            CtValTxt = $"{crossLineInfo.CtVal}";
        });
    }

}
